﻿using System;
using System.Threading;

namespace ThreadPoolDemo
{
    class Program
    {
        static void Main(string[] args)
        {

            for (int j = 0; j < 10; j++)
            {
                var t = new Thread(() => {
                    for (int i = 0; i < 10; i++)
                    {
                        Console.WriteLine($"第{j}个，工作线程id：{Thread.CurrentThread.ManagedThreadId}");
                    }
                });
                t.Start();

                //for (int j   = 0; j < 10; j++)
                //{
                //    ThreadPool.SetMinThreads(8,1);
                //    ThreadPool.QueueUserWorkItem(x =>
                //    {
                //        for (int i = 0; i < 10; i++)
                //        {
                //            Console.WriteLine($"工作线程id：{Thread.CurrentThread.ManagedThreadId}，返回值{x}");

                //        }
                //        // 回调函数是个object类型，可以传递 函数进去
                //    }, "Jet"+j);
            }


            Console.WriteLine($"主程序：{Thread.CurrentThread.ManagedThreadId}");

            Console.ReadLine(); 
        }
    }
}
